﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="LocationToColorConverter.cs" company="">
//   
// </copyright>
//  <summary>
//   The location to color converter.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace Shatranj
{
    using System;
    using System.Globalization;
    using System.Windows.Data;

    /// <summary>
    /// The location to color converter.
    /// </summary>
    public class LocationToColorConverter : IValueConverter
    {
        #region Public Methods and Operators

        /// <summary>
        /// The convert.
        /// </summary>
        /// <param name="value">
        /// The value.
        /// </param>
        /// <param name="targetType">
        /// The target type.
        /// </param>
        /// <param name="parameter">
        /// The parameter.
        /// </param>
        /// <param name="culture">
        /// The culture.
        /// </param>
        /// <returns>
        /// The <see cref="object"/>.
        /// </returns>
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var source = value as BoardSquare;
            if (source == null)
            {
                return "Transparent";
            }

            return ((source.Location.X + source.Location.Y) % 2 == 0) ? "Azure" : "LightBlue";
        }

        /// <summary>
        /// The convert back.
        /// </summary>
        /// <param name="value">
        /// The value.
        /// </param>
        /// <param name="targetType">
        /// The target type.
        /// </param>
        /// <param name="parameter">
        /// The parameter.
        /// </param>
        /// <param name="culture">
        /// The culture.
        /// </param>
        /// <returns>
        /// The <see cref="object"/>.
        /// </returns>
        /// <exception cref="NotImplementedException">
        /// </exception>
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}